package DAO.impl;

import DAO.AdminDAO;
import DAO.BaseDao;
import bean.Admin;

import java.sql.Connection;
import java.util.List;

/**
 * @author 栋
 * @date 2022/11/8
 * @description
 */
public class AdminDAOImpl extends BaseDao<Admin>implements AdminDAO {

    @Override
    public int add_amin(Connection conn, Admin admin) {
        String sql="insert into Admin(admin_id,admin_pwd) values(?,?)";
        return update(conn,sql,admin.getAdmin_id(),admin.getAdmin_pwd());
    }

    @Override
    public List<Admin> show_all_admin(Connection conn) {
        String sql="select * from Admin";
        return getForList(conn,sql);
    }

    @Override
    public Admin getAdminByAcc(Connection conn, String account) {
        String sql="select * from admin where admin_id=?";
        return getInstance(conn,sql,account);
    }
}
